{extend name="$_admin_layout"}

{block name="tpl_vars"}
    {eq name="_request_action" value="create"}
        {php}$page_title = '新建用户';{/php}
    {else /}
        {php}$page_title = '修改用户：' . $user_info['username'];{/php}
    {/eq}
{/block}

{block name="main-content"}
    <form id="user_form" class="form form-manager">
        <div class="box box-blue no-heading">
            <div class="box-body">

                <div class="row">
                    <div class="col-sm-12">
                        {:helper('admin/form')->render_group('username', $user_info['username'], 'text', '帐号')}
                        {:helper('admin/form')->render_group('nickname', $user_info['nickname'], 'text', '名称')}
                        {:helper('admin/form')->render_group('gid', $user_info['gid'], 'select', '用户组', null, array('list' => 'module_list'))}
                        {:helper('admin/form')->render_group('password', '', 'password', '密码')}
                        {:helper('admin/form')->render_group('email', $user_info['email'], 'text', '电子邮件')}
                        {:helper('admin/form')->render_group('mobile', $user_info['mobile'], 'text', '手机号')}
                        {:helper('admin/form')->render_group('status', $user_info['status'], 'switch', '状态', null, ['list' => 'status'])}
                        {:helper('admin/form')->render_submit_and_cancel(request()->url(), $_controller->url('index'))}

                        <script type="text/javascript">
                            $(function(){
                                $('#user_form').bootstrapValidator({
                                    fields: {
                                        username: {
                                            validators: {
                                                notEmpty: {
                                                    message: '帐号不能为空',
                                                },
                                            },
                                        },
                                        nickname: {
                                            validators: {
                                                notEmpty: {
                                                    message: '名称不能为空',
                                                },
                                            },
                                        },
                                    },
                                });
                            });
                        </script>
                    </div>
                </div>

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </form>
{/block}